import com.cn.Goods;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.SortedMap;

public class Demo2 {

    public static void main(String[] args) {
        ArrayList<Goods> goodsArrayList=new ArrayList<Goods>();
        addStore(goodsArrayList);
        do {
           int choose=chooseFuntion(goodsArrayList);
            switch (choose){
                case 1:
                    checx(goodsArrayList);
                    break;
                case 2:
                    chang(goodsArrayList);
                    break;
                case 3:
                    excit(goodsArrayList);
                    return;
                default:
                    System.out.println("序号输入错误");
                    break;
            }

        }while (true);


    }

    public static int chooseFuntion(ArrayList<Goods> goodsArrayList ){
        System.out.println("-----------库存管理-------------");
        System.out.println("1.查看库存清单");
        System.out.println("2.修改商品库存数量");
        System.out.println("3.退出");
        System.out.println("请输入要执行的操作序号");
        Scanner scanner=new Scanner(System.in);
        int choose=scanner.nextInt();
        return choose;
    }
    public static void addStore(ArrayList<Goods> goodsArrayList){
        Goods g1=new Goods();
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入需要的品牌型号 尺寸 价格 数量：");
        g1.brand=scanner.next();
        g1.size=scanner.nextInt();
        g1.price=scanner.nextInt();
        g1.count=scanner.nextInt();
        goodsArrayList.add(g1);
    }
    public static void checx(ArrayList<Goods> goodsArrayList){

        for (int i=0;i<goodsArrayList.size();i++ ){
            Goods goods=goodsArrayList.get(i);
            System.out.println("品牌 尺寸 价格 数量");
            System.out.println(goods.brand);
            System.out.println(goods.size);
            System.out.println( goods.price);
            System.out.println(goods.count);
        }
        System.out.println("\t");
    }
    public static void chang(ArrayList<Goods> goodsArrayList){
        System.out.println("修改商品库存");
        Scanner scanner=new Scanner(System.in);
        for (int i=0;i<goodsArrayList.size();i++){
            Goods goods=goodsArrayList.get(i);
            goods.count=scanner.nextInt();
            goodsArrayList.set(i,goods);
        }

    }
    public static void excit(ArrayList<Goods> goodsArrayList){
        System.out.println("退出成功");
        System.out.println("再见！");
    }
}
